import FlowGraph from '@/views/flow/graph'

// 节点选项对应映射关系
export function nodeOpt (id: any, globalGridAttr: any) {
  let curCel: any = null
  if (id.value) {
    const { graph } = FlowGraph
    const cell = graph.getCellById(id.value)
    if (!cell || !cell.isNode()) {
      return
    }
    curCel = cell
    globalGridAttr.nodeStroke = cell.attr('body/stroke')
    globalGridAttr.nodeStrokeWidth = cell.attr('body/strokeWidth')
    globalGridAttr.nodeFill = cell.attr('body/fill')
    globalGridAttr.nodeFontSize = cell.attr('text/fontSize')
    globalGridAttr.nodeColor = cell.attr('text/fill')
    globalGridAttr.nodeUsers = cell.attr('approve/users')
    globalGridAttr.text = cell.attr('text/text')
    globalGridAttr.user = cell.attr('approve/user')// 操作人
    globalGridAttr.selected = cell.attr('approve/selected')// 节点实际操作
    globalGridAttr.gudingRen = cell.attr('approve/gudingRen')//  固定人员
    globalGridAttr.checkedSp = cell.attr('approve/checkedSp')// 是否审批
    globalGridAttr.finished = cell.attr('approve/finished')// 结束方式
    globalGridAttr.blSort = cell.attr('approve/blSort')// 办理次序
    globalGridAttr.sortRule = cell.attr('approve/sortRule')// 排序规则
  }
  return curCel
}
